﻿using System;

namespace Rosetta.Default.AddIns.Text
{
    public sealed class StringInputter : Inputter
    {
        #region Fields

        private string value;

        #endregion

        #region Constructors

        public StringInputter()
            : base("String Inputter")
        {
            Category = "Text";
            ContextType = typeof(string);

            Add<int>("GetInt32", GetInt32);
            Add<string>("GetString", GetString);
        }

        #endregion

        #region Public Methods

        public override void UseContext(object context)
        {
            value = context as string;
        }

        #endregion

        #region Private Methods

        private int GetInt32()
        {
            return Convert.ToInt32(value);
        }

        private string GetString()
        {
            return value;
        }

        #endregion
    }
}